package com.haotian.http;

import java.util.Map;

import org.apache.log4j.Logger;

import com.alibaba.fastjson.JSONObject;

@Deprecated
public class _HttpClient implements AutoCloseable {

	private Logger log = Logger.getLogger(this.getClass());

	public String get(String uri, Map<String, String> params, String encoding) {
		try {
			return _HttpKit.get(uri, params, encoding).getStringMessage();
		} catch (Exception e) {
			log.error("", e);
			return null;
		}
	}

	public String post(String uri, Map<String, String> params, String encoding) {
		try {
			return _HttpKit.post(uri, params, encoding).getStringMessage();
		} catch (Exception e) {
			log.error("", e);
			return null;
		}
	}

	public String json(String uri, JSONObject json, String encoding) {
		try {
			return _HttpKit.json(uri, json, encoding).getStringMessage();
		} catch (Exception e) {
			log.error("", e);
			return null;
		}
	}

	public String postStringEntity(String uri, String data, String encoding, String contentType) {
		try {
			return _HttpKit.postStringEntity(uri, data, encoding, contentType).getStringMessage();
		} catch (Exception e) {
			log.error("", e);
			return null;
		}
	}

	public String postStringEntity(String uri, String data, Map<String, String> headers, String encoding,
			String contentType) {
		try {
			return _HttpKit.postStringEntity(uri, data, headers, encoding, contentType).getStringMessage();
		} catch (Exception e) {
			log.error("", e);
			return null;
		}
	}

	public byte[] getBytes(String uri) {
		try {
			return _HttpKit.getBytes(uri).getByteArrayMessage();
		} catch (Exception e) {
			log.error("", e);
			return null;
		}
	}

	@Override
	public void close() throws Exception {

	}

}
